//
//  ZRViewController.m
//  Vpay
//
//  Created by 伟大大 on 2018/9/19.
//  Copyright © 2018年 丁伟佳. All rights reserved.
//

#import "ZRViewController.h"
#import "LXWebViewController.h"
@interface ZRViewController () {
    UIButton *rightNavBtn;

}

@end

@implementation ZRViewController

#pragma mark -
#pragma mark - for lifeCircle
#pragma mark -
- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    rightNavBtn.hidden = NO;
//    [self.navigationController setNavigationBarHidden:YES animated:animated];
    
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    rightNavBtn.hidden = YES;
//    [self.navigationController setNavigationBarHidden:NO animated:animated];
    
    //    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
//    self.view.backgroundColor = BACKCOLOR;
    
//    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
//    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"转出";
    self.view = [[[NSBundle mainBundle]loadNibNamed:@"ZRViewController" owner:self options:nil]lastObject];
    self.view.backgroundColor = BACKCOLOR;
    
    
    
    [self initData];
    [self initNavBtns];
    [self initViews];
    
    //    [NSThread detachNewThreadSelector:@selector(requestData) toTarget:self withObject:nil];
    
    //    [NSThread detachNewThreadSelector:@selector(requestDingdanData) toTarget:self withObject:nil];
}
#pragma mark -
#pragma mark - for data
#pragma mark -
- (void)initData {
}
#pragma mark -
#pragma mark - for Views
#pragma mark -

- (void)initNavBtns {
    
    rightNavBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightNavBtn setFrame:CGRectMake1(243-4, 7, 80, 20)];
    //    rightNavBtn.imageEdgeInsets = UIEdgeInsetsMake(5, 10, 0, 0);
    [rightNavBtn setTitle:@"转出记录" forState:UIControlStateNormal];
    
    rightNavBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [rightNavBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [rightNavBtn addTarget:self action:@selector(rightNavBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationController.navigationBar addSubview:rightNavBtn];
    self.navigationItem.leftBarButtonItem = [AppUtility getNavBtnItemLefBacktWith:@selector(leftNavBtnClicked) andTarget:self];
}

- (void)initViews {

    self.UID_textfiled.delegate = self;
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTouched)];
    [self.view addGestureRecognizer:tap1];
}
-(void)tapTouched{
    
    if ([_UID_textfiled isFirstResponder]) {
        [_UID_textfiled resignFirstResponder];
    }
    
    
    
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    if ([string isEqualToString:@"\n"]) {
        [textField resignFirstResponder];
        return NO;
    }
    
    if (textField==self.UID_textfiled) {
        
        
        if (![AppUtility validateNumber:string]) {
            [self.view makeToast:@"请输入数字"];
            [textField resignFirstResponder];
            textField.text = @"";
            
        }
        return [AppUtility validateNumber:string];
    }
    else{
        
        return YES;
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)dealloc {
    [_UID_textfiled release];
    [super dealloc];
}
#pragma mark -
#pragma mark for evevts
#pragma mark -
- (void)leftNavBtnClicked {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)rightNavBtnClicked {
    LXWebViewController *vc = [[LXWebViewController alloc]init];
    vc.LXtitle = @"转出记录";
    vc.urlStr = @"http://vpay1.luck8868.com/Index/Turncords.html";
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)Next_btnClik:(UIButton *)sender {
}

- (IBAction)DHJF_btnClik:(UIButton *)sender {
}
@end
